<?php
require dirname ( __FILE__ ) . '/../lib/init.php';

$_POST = addslashes_deep ( $_POST );
//$uid = $_SESSION ["USERID"];
$userdo = $_POST ["useraction"];
$table = "kt_glory";
$curdate = date ( "Y-m-d H:i:s" );
$curdates = date ( "Ymdhis" );
global $db;
if ($userdo == "GLORYADD") {
    $glory_year = $_POST ["glory_year"];
	$glory_content = $_POST ["glory_content"];
	$data = array (
			'year' => $glory_year
	);
	$data ["content"] = $glory_content;
	$data ["type"] = 1;
	$db->insert ( $table, $data );
} else if ($userdo == "GLORYEDIT") {
	$oid = $_POST ["oid"];
	$glory_year = $_POST ["glory_year"];
	$glory_content = $_POST ["glory_content"];
	$data = array (
			'year' => $glory_year
	);
	$data ["content"] = $glory_content;
	$data ["type"] = 1;
    $db->update ( $table, $data, $oid );
} else if ($userdo == "GLORYDEL") {
	$oid = $_POST ["oid"];
	$oid = array_map ( "intval", $oid );
	$where = 'oid IN (' . join ( ', ', $oid ) . ')';
	$db->delete ( $table, $where );
}

 